<template>
        <van-nav-bar
  title="推荐排行榜"
  left-text=""
  left-arrow
  @click-left="onClickLeft"
/>  
  <p><van-tag type="primary">usdt</van-tag></p> 

  <div>
  <van-cell-group>
    <van-cell v-for="(row, index) in list" :key="index">
      <template #title>
        <div class="table-row">
          <span v-for="(cell, cellIndex) in row" :key="cellIndex" class="table-cell" >{{ cell }}</span>
        </div>
      </template>
    </van-cell>
  </van-cell-group>
 
  </div>
 
</template>

<script setup>
import {_getMyWallet,_selectMyWallet,_getItemBySymbol,_getInviteUser,_getInviteMoneyUser} from '@/service/my.js'
import { onMounted } from 'vue'
import { ref,reactive } from 'vue'
const MyWallet = ref([])
const price  = ref();
const onClickLeft = () => history.back();
const list = ref([])
const clickedItem = ref({});
const firstcount = ref(0);
const reward = ref(0);
const secondcount= ref(0);
const firstList = ref({});
const secondList = ref({});
const rewardList = ref({});
const activeMainTab = ref('');
function sleep(ms) {
                    return new Promise(resolve => setTimeout(resolve, ms));
                }

let dialogTimer = null;
const isLoading = ref(false)
const doSomething =()=> {
  isLoading.value=true
  sleep(5000);
  isLoading.value=false

}

const onTabChange=()=>{
}   


const showDialog = ref(false);
onMounted(() => {
    getMyWallet()
    getInviteUser()
    getInviteMoneyUser()
});

const onCellClick =(row)=>{
  isLoading.value=true
  showDialog.value = true
  dialogTimer = setInterval(()=>{
   const symbol = row.symbol
   const sysboldata = row.symbolData
  _getItemBySymbol(symbol,sysboldata).then((res)=>{
    clickedItem.value = res
   }) 
}, 1000) // 每1秒执行1次
}

const closeItem=()=>{
  showDialog.value = false
  clearInterval(dialogTimer)
}

const getInviteUser = () => {
  _getInviteUser({
       
    }).then((res) => {
      firstList.value = res.firstResultList
      secondList.value = res.secondResultList
      firstcount.value = res.firstAll
      secondcount.value = res.secondAll
    })
}
const getInviteMoneyUser = ()=>{
  _getInviteMoneyUser({}).then((res)=>{
    rewardList.value = res.resultList
    reward.value = res.allMoney
  })
}

const getMyWallet = () => {
  _selectMyWallet({
       
    }).then((res) => {
        list.value = res
    })
}

</script>
<style lang="scss" scoped>
.table-row {
  display: flex;
}
.table-cell {
  flex: 1;
  padding: 10px;
  border: 1px solid #ccc;
}
.van-dialog {
            background-color: #f5f5f5; /* 设置 van-dialog 的背景颜色 */
        }
      .van-dialog__header {
            font-weight: 700; /* 设置 van-dialog 标题字体粗细 */
        }
</style>